<template>
  <el-dialog title="下场记录" :visible.sync="showXcLog" @close="close" width="70%"  append-to-body>
    <!-- 查询条件 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-select v-model="queryParams.sfhk" style="width: 100%;" placeholder="请选择">
          <el-option
            v-for="item in hkList"
            :key="item.dictValue"
            :label="item.dictLabel"
            :value="item.dictValue">
          </el-option>
        </el-select>
      </el-col>
      <el-col :span="1.5">
        <el-input v-model="queryParams.hkje" placeholder="请输入回款金额"></el-input>
      </el-col>
<!--      <el-col :span="1.5">-->
<!--          <el-date-picker clearable-->
<!--                          style="width: 100%"-->
<!--                          v-model="queryParams.hksj"-->
<!--                          type="date"-->
<!--                          value-format="yyyy-MM-dd"-->
<!--                          placeholder="请选择回款时间">-->
<!--          </el-date-picker>-->
<!--      </el-col>-->
      <el-col :span="1.5">
        <el-button @click="resetData">重置</el-button>
        <el-button type="primary" @click="init">查询</el-button>
      </el-col>
    </el-row>
    <!-- 列表 -->
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="sfhk"
        label="是否回款">
        <template slot-scope="scope">
          <span v-if="scope.row.sfhk === '1'">是</span>
          <span v-if="scope.row.sfhk === '2'">部分回款</span>
          <span v-if="scope.row.sfhk === '3'">否</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="hkje"
        label="回款金额">
      </el-table-column>
      <el-table-column
        prop="hksj"
        label="回款日期">
      </el-table-column>
      <el-table-column
        prop="createtime"
        label="日志记录时间">
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="init"
    />
  </el-dialog>
</template>

<script>
import { listWgdLog } from '@/api/gd/wgdLog'
export default {
  name: 'XcLogList',
  props: {
    showXcLog: {
      type: Boolean,
      default: false
    },
    logData: {
      type: Object
    }
  },
  data() {
    return {
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 12,
        wgdid: this.logData.id,
        sfhk: '',
        hkje: '',
        hksj: '',
      },
      tableData: [],
      hkList: [],
    }
  },
  created() {
    this.init()
    // 是否回款
    this.getDicts("gd_sfhk").then(res => {
      this.hkList = res.data
    })
  },
  methods: {
    init() {
      listWgdLog(this.queryParams).then(res => {
          if(res.code === 200) {
            this.tableData = res.rows
          }
      }).catch(err => {this.$message.error(err.ms)})
    },
    resetData() {
      this. queryParams= {
        pageNum: 1,
        pageSize: 12,
        wgdid: this.logData.id,
        sfhk: '',
        hkje: '',
        hksj: '',
      }
      this.init()
    },
    close() {
      this.$emit("closeHkLog")
    }
  }
}
</script>

<style scoped>

</style>
